package org.myxdb.core.data;

import java.util.List;

import org.myxdb.core.object.*;
import org.myxdb.core.config.*;


public class data {

		public boolean createdoc(String name ,String path,String dbname)
		{
			XMLDoc document = new XMLDoc();
			document.setName(name);
			document.setSrc(path);
			Doc docdao = new Doc(System.getProperty("user.dir")+"/conf/data.xml");
			docdao.read();
			docdao.addDoc(document, dbname);
			docdao.write("utf-8");
			return true;
		}
		
		public boolean deletedoc(String name ,String dbname)
		{
			XMLDoc document = new XMLDoc();
			document.setName(name);	
			Doc docdao = new Doc(System.getProperty("user.dir")+"/conf/data.xml");
			docdao.read();
			docdao.delDoc(document, dbname);
			return true;
		}
		
		public List listdoc(String dbname)
		{
			Doc docdao = new Doc(System.getProperty("user.dir")+"/conf/data.xml");
			List list = docdao.Available(dbname);
			return list;
			
		}
}
